
	* Appendix B - 	Election Salience and Reported Turnout
	
clear all	 
set maxvar 10000
	 
cd "$data"
use "cses_imd_original.dta", clear

gen daysafter = IMD1014_1 if IMD1014_1<363

gen voted = .
replace voted = 1 if IMD3001==1 
replace voted = 0 if IMD3001==0

gen dk = . 
replace dk = 1 if  IMD3001==9999993 | IMD3001==9999997 | IMD3001==9999998
replace dk = 0 if IMD3001==0 | IMD3001==1

encode IMD1004, generate(election)
encode IMD1006_NAM, generate(country)

keep daysafter voted election country dk

* FIGURE B1 - REPORTED TURNOUT IS HIGHER CLOSER TO THE ELECTION DAY

mixed voted daysafter || country: || election:
margins, at(daysafter=(0(10)360))
marginsplot, plot1opts(msymbol(hollow_circle) mcolor(gs5%50)) recast(scatter) recastci(rspike) level(95) ci1opts(color(gs5%50)) graphregion(color(white)) ytitle("predicted average turnout", size()) xtitle("days since election") ylabel(0.65(0.05)0.95, gstyle(dot)) xlabel(0(30)300, gstyle(dot)) title("") addplot(hist daysafter, percent color(gs10%70) yaxis(2) ytitle("", size(2) axis(2)) yscale(range(0(5)30) axis(2) alt)) legend(off)
graph save "${figures}/FigureB1.gph", replace 
graph export "${figures}/FigureB1.png", as(png) replace

* FIGURE B2 - DON'T KNOW RESPONSES IN REPORTED TURNOUT IS LOWER CLOSER TO THE ELECTION DAY

mixed dk daysafter || country: || election:
margins, at(daysafter=(0(10)360))
marginsplot, plot1opts(msymbol(hollow_circle) mcolor(gs5%50)) recast(scatter) recastci(rspike) level(95) ci1opts(color(gs5%50)) graphregion(color(white)) ytitle("predicted average don't know", size()) xtitle("days since election") ylabel() xlabel(0(30)300, gstyle(dot)) title("") addplot(hist daysafter, percent color(gs10%70) yaxis(2) ytitle("", size(2) axis(2)) yscale(range(0(5)30) axis(2) alt)) legend(off)
graph save "${figures}/FigureB2.gph", replace 
graph export "${figures}/FigureB2.png", as(png) replace


 